package net.asfun.jvalog.resource;

import javax.jdo.Query;

import net.asfun.jvalog.common.Jdoer;
import net.asfun.jvalog.common.JdoerFactory;
import net.asfun.jvalog.entity.Store;

public class StoreDao {

	public static void deleteAll() {
		Jdoer<Store> jds = JdoerFactory.jdoStore;
		jds.delete(jds.all());
	}
	
	public static Store getByItem(String item) {
		Jdoer<Store> jds = JdoerFactory.jdoStore;
		Query query = jds.prepareQuery();
		query.setFilter("item == akey");
		query.declareParameters("String akey");
		return jds.unique(query, item);
	}

	public static int count() {
		return JdoerFactory.jdoStore.all().size();
	}
}
